package com.qtummatrix.service.impl;

import com.qtummatrix.dao.AuthotityManagerDao;
import com.qtummatrix.entity.EmpinfoEntity;
import com.qtummatrix.entity.OrganizationEntity;
import com.qtummatrix.service.AuthotityManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * create by Gongshiyong  2019-12-07 11:31
 */
@Service
public class AuthotityManagerServiceImpl implements AuthotityManagerService {

    @Autowired
    private AuthotityManagerDao authotityManagerDao;

    public void setAuthotityManagerDao(AuthotityManagerDao authotityManagerDao) {
        this.authotityManagerDao = authotityManagerDao;
    }

    public List<Map<String, Object>> getUserList(String tel, String username, String rooleid, int bankid,
                                                 int organization, int state, int pageNo, int pageSize) {
        return authotityManagerDao.getUserList(tel, username, rooleid, bankid, organization, state, pageNo, pageSize);
    }

    public Integer getUserSize(String tel, String username, String rooleid, int bankid, int organization, int state) {
        return authotityManagerDao.getUserSize(tel, username, rooleid, bankid, organization, state);
    }

    public int resetUserPassword(int id) {
        return authotityManagerDao.resetUserPassword(id);
    }

    public int userOpenEdit(int id) {
        return authotityManagerDao.userOpenEdit(id);
    }

    public int validatePhone(String phone) {
        return authotityManagerDao.validatePhone(phone);
    }

    public EmpinfoEntity UserLoginValidate(String tel, String password) {
        return authotityManagerDao.UserLoginValidate(tel, password);
    }

    public int ValidateaddUserTel(String tel) {
        int i = authotityManagerDao.ValidateaddUserTel(tel);
        return i > 0 ? 1 : 0;
    }

    public List<OrganizationEntity> getAllCompany() {
        return authotityManagerDao.getAllCompany();
    }

    public List<Map<String, Object>> getAllBankName() {
        return authotityManagerDao.getAllBankName();
    }

    public List<Map<String, Object>> getAllRole() {
        return authotityManagerDao.getAllRole();
    }

    public int AddUserInfo(String username, String password, String tel, int bankid, String roleid, Date entrytime,
                           int organization, String email, String linkmanname, String linkmantel, String companytel) {
        return authotityManagerDao.AddUserInfo(username, password, tel, bankid, roleid, entrytime, organization, email,
                linkmanname, linkmantel, companytel);
    }

    public List<Map<String, Object>> getRoleList(String rooname, String bankname, int pageNo, int pageSize) {
        return authotityManagerDao.getRoleList(rooname, bankname, pageNo, pageSize);
    }

    public int getRoleSize(String rooname, String bankname) {
        return authotityManagerDao.getRoleSize(rooname, bankname);
    }

    public int deleteRoleById(int id) {
        return authotityManagerDao.deleteRoleById(id);
    }

    public int addRole(String rolename, int bankid, String description, String rolePermission) {
        return authotityManagerDao.addRole(rolename, bankid, description, rolePermission);
    }

    public int getValidateRoleName(String rolename) {
        return authotityManagerDao.getValidateRoleName(rolename);
    }

    public Map<String, String> getCurrentUserPerssion(String tel) {
        return authotityManagerDao.getCurrentUserPerssion(tel);
    }

    public String eidtPassword(String tel, String oldPassword, String newPassword) {
        return authotityManagerDao.eidtPassword(tel, oldPassword, newPassword);
    }

    public String getHomePageInfo() {
        return authotityManagerDao.getHomePageInfo();
    }
}
